<?php
/**
 * Created by PhpStorm.
 * User: xiao
 * Date: 2017/2/9
 * Time: 下午3:25
 */

namespace app\src\weixin\action;

use app\src\base\action\BaseAction;
use app\src\user\logic\MemberConfigLogic;
use app\src\weixin\logic\WeixinLogic;


class WxSendAction extends BaseAction
{

    public function sendYJ($uid,$money){
        $money=(float)$money/100;
        $result = (new MemberConfigLogic())->getInfo(['uid'=>$uid]);
//dump($result['info']['wxopenid']);exit;
        if($result['status']&&!empty($result['info']['wxopenid'])){
            $openid=$result['info']['wxopenid'];
            $time=date('Y-m-d H:i:s', time());
            $data=array(
                "touser"=>"$openid",
                "template_id"=>"faYw-64BYvb-2qG6e4EZ41EovJZ4VJ35eA5ymMW7UxY",
                "data"=>array(
                    "first"=>array("value"=>"获得佣金！","color"=>"#173177"),
                    "keyword1"=>array("value"=>$money."元","color"=>"#173177"),
                    "keyword2"=>array("value"=>"$time","color"=>"#173177"),
                    "remark"=>array("value"=>"请进入店铺查看详情！","color"=>"#173177")
                ),

            );

            (new WeixinLogic('wx8ec96a74711b3fb0','1b08bfa933d0280736f833dee23dbd68'))->sendTmplMsgToFans($data);
        }

    }



}